package version1_0;

import java.util.Scanner;

/**
 * @program:IntelliJ IDEA
 * @Description:main函数
 * @author:Mr.CheCheHuiBujianO
 * @data: 2022/7/12 12:43
 */
public class GameMain1_0 {
    static int gameTime = 0;//游戏进行局数
    static int gameWinTime = 0;//游戏胜利局数
    static int gameLoseTime = 0;//游戏失败局数
    public static void main(String[] args) {
        System.out.println("请输入你的昵称");
        Scanner in = new Scanner(System.in);
        People people = new People();
        String peopleName = in.nextLine();
        people.setPeopleName(peopleName);
        System.out.println("随机为您产生Id");
        String peopleId = people.getPeopleId();
        System.out.println("您的Id为"+peopleId);
        //创建电脑对象
        Computer computer = new Computer();
        //为电脑对象设置手势
        computer.setComputerGesture();
        //进行游戏结果的判断
        while(gameTime < 5 && gameWinTime < 3 && gameLoseTime < 3){
            //通过get和set方法进行结果的获得
            //进行手势的输入
            Scanner in1 = new Scanner(System.in);
            System.out.println("请在下面三个手势中选择一个输入： 1.石头 2.剪刀 3.布,输入文字");
            String peopleGesture = in1.nextLine();
            people.setPeopleGesture(peopleGesture);
            //刷新电脑手势
            computer.setComputerGesture();
            String gameJudge = new GameJudge().gameJudge(people.getPeopleGesture(), computer.getComputerGesture());
            switch (gameJudge){
                case "胜利":
                    gameWinTime++;
                    gameTime++;
                    new GameJudge().printResult(gameWinTime,gameLoseTime,gameTime,gameJudge);
                    break;
                case "失败":
                    gameLoseTime++;
                    gameTime++;
                    new GameJudge().printResult(gameWinTime,gameLoseTime,gameTime,gameJudge);
                    break;
                case "平局":
                    gameTime++;
                    new GameJudge().printResult(gameWinTime,gameLoseTime,gameTime,gameJudge);
                    break;
                default:
                    System.out.println("请检查你的输入！！！");
            }
        }
    }
}
